import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home/index.vue";

import { loadable } from '../utils/loadable'

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/course",
    name: "course",
    component: loadable(() =>
      import("@/views/Course"))
  },
  {
    path: "/profile",
    name: "profile",
    component: loadable(() => import("@/views/Profile"))
  },
  {
    path: "/my",
    name: "my",
    component: loadable(() => import("@/views/My"))
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
